package reflect;

/**
 * @Author: Miyako
 * @Date: 2024-07-23-9:11
 * @Description: 反射demo，字节码对象
 */
public class Class {
    public static void main (String[] args) throws ClassNotFoundException {
        java.lang.Class<String> s = String.class;
        java.lang.Class<String> b = String.class;
        java.lang.Class<Integer> v = int.class;
        System.out.println(b.hashCode());
        java.lang.Class<Integer> h = int.class;
        java.lang.Class<Exception> e = Exception.class;
        System.out.println(e.getSuperclass().getSuperclass());
//        System.out.println(h.getSuperclass().getName());
        System.out.println(e.getClassLoader());//根类类加载器,null
        java.lang.Class<Class> classClass = Class.class;
        System.out.println(classClass.getClassLoader());//类加载器,
        System.out.println(classClass.getSuperclass());
        System.out.println(classClass.getSuperclass().getSuperclass());
        System.out.println(classClass.isEnum());//是否是枚举类型
        System.out.println(classClass.isArray());//是否是数组类型
        System.out.println(classClass.isInterface());//是否是接口类型
        System.out.println(classClass.isAnnotation());//是否是注解类型
        System.out.println(classClass.isPrimitive());//是否是基本类型
        System.out.println(classClass.isInstance(new Object()));//是否是实例
    }
}
